package com.wuxiaofan.product.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.product.entity.SpuComment;
import com.wuxiaofan.product.entity.custom.SpuCommentCustom;
import com.wuxiaofan.product.mapper.SpuCommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.product.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SpuCommentService {
    @Autowired
    private SpuCommentMapper pmsSpuCommentMapper;
    @Resource
    private Idgenerator idgenerator;
    public SpuComment findById(String id){
        return pmsSpuCommentMapper.selectById(id);
    }

    public SpuCommentCustom findCountByMap(Map paraMap){
        return pmsSpuCommentMapper.findCountByMap(paraMap);
    }

    public SpuCommentCustom findGroupByMap(Map paraMap){
        return pmsSpuCommentMapper.findGroupByMap(paraMap);
    }

    public List<SpuCommentCustom> findByMap(Map paraMap){
        return pmsSpuCommentMapper.findByMap(paraMap);
    }

    public Page<SpuCommentCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(pmsSpuCommentMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        pmsSpuCommentMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        pmsSpuCommentMapper.deleteById(id);
    }

    public SpuComment save(SpuComment pmsSpuComment){
        pmsSpuComment.setId(idgenerator.getId());
        pmsSpuCommentMapper.insert(pmsSpuComment);
        return pmsSpuComment;
    }

}
